package com.abc;

import java.io.File;
import java.io.FileInputStream; 
import java.util.*;
public class Words2 {
		public static void main(String args[]) throws 
			Exception{
			int count =0;
			char words;
			String str;
			Scanner sc=new Scanner(System.in);
			File file = new File("D:\\Temp\\word.txt");
			FileInputStream fil = new FileInputStream(file);
			byte[] bytesArray = new byte[(int)file.length()];
			fil.read(bytesArray);
			String s = new String(bytesArray);
			
			String [] data = s.split(" ");
			str = sc.nextLine();
			System.out.println("请输入开头的字母：");
			words = sc.next().charAt(0);
			for(int i =0; i < data.length; i++){
				if(data[i].charAt(0)== words) {
						count++;
						}

				}

	        System.out.println("共有单词个数为：" +count);}
	}




